package com.thyc.server;


import cn.hutool.core.convert.Convert;

import java.io.*;
import java.net.Socket;

/**
 * 模拟客户端数据
 */
public class Clien {
    public static void main(String[] args) throws IOException {
        Socket socket = new Socket("127.0.0.1",8051);
        OutputStream outputStream = socket.getOutputStream();

        PrintStream outputStreamWriter = new PrintStream(outputStream);
        String a = "45 54 55 4E 47 00";
        String b = "24 38 38 30 30 30 30 30 30 30 30 30 30 30 30 30 30 00 00 04 80 F4 7F 00 00";
        String c = "45 54 55 4E 47 3A 32 34 30 33 30 35 30 30 34 31 30 33 37 32 39 00";
        byte[] command = Convert.hexToBytes((a).replace(" ",""));
        outputStreamWriter.write(command);
        outputStreamWriter.flush();
        InputStream inputStream = socket.getInputStream();
        byte[] bytes = new byte[20];
        DataInputStream dataInputStream = new DataInputStream(inputStream);
        while (dataInputStream.read(bytes) != -1) {
            System.out.println(new String(bytes));
        }

    }
}
